var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var user = require('../../../utils/user.js');
var app = getApp();

Page({
  data: {
    userInfo: {
      nickName: '点击登录',
      avatarUrl: '/static/images/my.png'
    },
    msInfo:null,
    hasLogin: false
  },
  onLoad: function(options) {
    // 页面初始化 options为页面跳转所带来的参数
  },
  onReady: function() {
  },
  onShow: function() {
    //获取用户的登录信息
    this.setData({
      msInfo:wx.getStorageSync("msInfo")
    })
  },
  onHide: function() {
    // 页面隐藏
  },
  onUnload: function() {
    // 页面关闭
  },
  goLogin() {
    // if (!this.data.hasLogin) {
      wx.navigateTo({
        url: "/pages/auth/accountLogin/accountLogin"
      });
    // }
  },
  exitLogin: function() {
    var that = this;
    wx.showModal({
      title: '',
      confirmColor: '#b4282d',
      content: '退出登录？',
      success: function(res) {
        console.log(res)
        if (res.confirm) {
          wx.removeStorage({
            key: 'msInfo',
            success: function(res) {
              that.setData({
                msInfo: ""
              })
              that.onLoad()
            },
          })
        }
      }
    })
  }
})